<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>관리자 상품 리스트</title>
</head>
<body>
<form action="prolist.do" name="prolist" method="get">
	<table width="200" align="center" border="0" cellspacing="0" cellpadding="2">
			<tr>
				<td align="center">
					<select name="keyField">
						<option value="p_code">상품 코드</option>
						<option value="p_name">상품 이름</option>
						<option value="p_time">남은 시간</option>
						<option value="all">모두</option>
					</select>
				</td>
				<td>
					<input type="text" size="16" name="keyWord">
				</td>
				<td>
					<input type="submit" value="검색">
				</td>
			</tr>
		</table><br>
		
		<table width="80%" border="0">
			<tr>
			<c:forEach var="article" items="${list}">
				<c:if test="${article.p_valid != 'off'}">
				<td>
					<table>
					<tr height="250">
					<td width="250" colspan="6">
					<c:if test="${!empty article.p_listimage}">
					<a href="detailList.do?p_code=${article.p_code}">
					<img src="../adminproductupload/${article.p_listimage}" width="250" height="250">
					</a>
					</c:if>
					</td><%-- prolist.do?p_listimage=${article.p_listimage} --%>
					</tr>
					<tr>
					<td align="center" width="10%">
						${number}
						<c:set var="number" value="${number-1}"/>   
					</td>
					<td>${article.p_code}</td>
					<td>${article.p_name}</td>
					<td>${article.p_time}</td>
					<td>
					<c:if test="${article.p_amount > 0}">
					${article.p_amount} 개
					</c:if>
					<c:if test="${article.p_amount == 0}">
					0 개
					</c:if>  
					</td>
					<td>${article.p_valid}</td>
					</tr>
					</table>
					</td>
					<c:if test="${number%5 == 1}">
					<tr><td></td></tr>
					</c:if></c:if>
			</c:forEach>
			
			</tr>
			<c:if test="${count == 0 }">
				<tr align="center">
					<td colspan="6">등록된 상품이 없습니다.</td>
				</tr>
			</c:if>
		</table>
		<br><br><br>
<div id=pageU align="center">${pagingHtml}</div>
</form>		
</body>
</html>